ImageGear Professional v18 for Mac
Displaying an Image

As soon an image is loaded it can be displayed on screen. The simplest way to do this is to use the IG_dspl_image_draw() function. In our sample this function is called in drawRect method of main view class.

 
Copy Code

- (void)drawRect:(NSRect)dirtyRect
{
    if(IG_image_is_valid(hIGear))
    {
        // Get device context
        CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
        if([NSGraphicsContext currentContextDrawingToScreen])
            // Draw the image to the screen
            IG_dspl_image_draw(hIGear, 0, (__bridge HWND)self, (HDC)myContext, NULL);
        else
            // Print the image
            IG_dspl_image_print(hIGear, 0, (HDC)myContext, FALSE);
    }
}

Here is the sample application with a 24-bit image loaded:

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback